<%@ taglib prefix="c" uri="/WEB-INF/tlds/hdiv-c.tld"%>
<%@ taglib prefix="form" uri="/WEB-INF/tlds/hdiv-spring-form-3_0_4.tld"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<c:url value="selecCliente.html" var="seleccionarCliente"/>
<%@ page contentType="text/form;charset=windows-1252"%>
<script src="javascript/jquery.displaytag-ajax-1.2.js" type="text/javascript"></script>
  <script type="text/javascript">  
    
    $(function() {
        $('span.pagelinks>a, table#dispTable>thead>tr>th>a').live('click', function(){
            $.get($(this).attr('href'), function(responseText, status, xmlHttpRequest){
                $('#displayTagDiv').html($('#displayTagDiv', responseText).html());
                }
            )            
            return false;
        })
    });
    
    $(document).ready(function(){                
        $.getJSON("<c:url value='selecClienteInd.html'/>", {accion : "searchDesCliente" },function(data){
            $("#desCliente").autocomplete({source:data});
        });        
        $("form").submit(function(){
            return false;
        });
        //$("#desPunto").focus(function(){$("#desPunto").bestupper();});
        $("#desCliente").bestupper({
            clear:false
        });
        $("#mostrar").click(function(){ 
            $.get("<c:url value='selecClienteInd.html'/>",{accion:"buscarCliente",desCliente:document.forms[0].desCliente.value}, function(responseText, status, xmlHttpRequest){
                $('#displayTagDiv').html($('#displayTagDiv', responseText).html());
                }
            )            
        });
        $("#aceptar").click(function(){
            self.close();
         }
        );
        
    });
    function setChkCliente(checkObj){
        var idChkObj = checkObj.checked;
        if(idChkObj){
            $.getJSON("<c:url value='selecClienteInd.html'/>", {accion : "selectCodCliente",codCliente: checkObj.value});
        }else{
            $.getJSON("<c:url value='selecClienteInd.html'/>", {accion : "deselectCodCliente",codCliente: checkObj.value});
        }        
    }  
      
  </script>
  <meta http-equiv="Content-Type" content="text/form;charset=windows-1252">
  
<body>
<form:form modelAttribute="formClie" name="form" action="#">
<form:hidden path="accion"/>
<form:hidden path="cliente"/>
    <table id="fullheighttable" width="610px" align="center">
        <tr>
            <td align="left" valign="top" class="fondo_contenido padtop16left21">
                <table>
                    <tr>
                        <td class="verdana11bazul">Cliente</td>
                        <td>
                            <form:input path="desCliente" cssClass="fondo_txtbox258"/>
                        </td>
                        <td>
                            <input type="button" class="boton" id="mostrar" value="Mostrar"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" style="color:red;font-weight:bold;text-align:left;">
                        Lista de Clientes.
                        </td>
                    </tr>                    
                    <tr>
                        <td colspan="3">
                        <div id="displayTagDiv">
                        <c:set var="count" value="0"/>
                        <display:table name="listClientes" class="its" 
                                       pagesize="10" id="Cliente"
                                       requestURI="/selecClienteInd.html">
                            
                            <display:column title="Sel">
                                <c:set var="count" value="${count+1}"/>
                                <input type="radio" id="_chk" name="_chk"  onclick="setChkCliente(this);" value="${Cliente.codCliente}" ${Cliente.chkMarca}/>
                            </display:column>
                            <display:column class="hiddenColumn" headerClass="hiddenColumn">
                                <input type="radio" id="_chkNombre${Cliente.codCliente}" value="${Cliente.nombre}" />
                            </display:column>
                            <display:column escapeXml="true" style="width:350px;text-align:left;" property="nombre" title="Descripci&oacute;n"/>
                        </display:table>
                        </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" align="center">                
                            <input type="button" value="Aceptar" id="aceptar" class="boton"/>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr><td>

        </td></tr>
    </table>
</form:form>
</body>